package com.luo.backend.repository;

import com.luo.backend.entity.OrderItem;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * 订单商品明细数据访问接口
 */
@Repository
public interface OrderItemRepository extends JpaRepository<OrderItem, Long> {
    
    /**
     * 根据订单ID查找订单商品明细
     */
    List<OrderItem> findByOrderIdOrderByCreatedAtAsc(Long orderId);
    
    /**
     * 根据订单ID查找订单商品明细（简化版）
     */
    List<OrderItem> findByOrderId(Long orderId);
    
    /**
     * 根据订单ID删除订单商品明细
     */
    void deleteByOrderId(Long orderId);
}

